package com.nbk.composition.dao.bean

import com.baomidou.mybatisplus.annotation.IdType
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import com.fasterxml.jackson.annotation.JsonInclude
import com.nbk.composition.dao.convertor.ActionTypeHandler
import com.nbk.composition.dao.convertor.ListTypeHandler
import org.apache.ibatis.type.JdbcType

/**
 * Author:  LuoHaoLun
 * Email :  506503279@qq.com
 * Date  :  2021/5/25
 */
@TableName(value = "composition", autoResultMap = true)
data class Composition(
@TableId(type = IdType.AUTO)
var id: Int = -1,
var type: String = "",  // 作文类型
var genre: String = "", // 作文体裁
var title: String = "", // 作文标题
var requirement: String = "",   // 要求
var content: String = "",         // 内容
var state: String = "",         // 状态：待支付、待批改、待评价、已评价
var studentId: Int = -1,         // 学生id
var uploadTime: String = "",    // 上传日期

var residueCount: Int = 0,      // 剩余批改次数
var seq: Int = 0,               // 批改序号

var batchNumber: String = "",   // 交易流水号
var payType: String = "",       // 支付类型：单次，多次
var orderId: Int = -1,
var teacherId: Int = -1,
@TableField(typeHandler = ActionTypeHandler::class, jdbcType = JdbcType.LONGVARCHAR)
var comment: Action? = null,       // 总评
var score: Int = 0,         // 评分
var scoreSystem: Int = 100,     // 分制
var correctTime: String = "", // 批改时间
@TableField(typeHandler = ListTypeHandler::class, jdbcType = JdbcType.LONGVARCHAR)
val correct: MutableList<Action> = mutableListOf(),  // 批改内容步骤

@TableField(exist = false)
var isAmendOrSendBack: Boolean? = null        // 是否是修正提交或退回重写

)

@JsonInclude(JsonInclude.Include.NON_NULL)
data class Action(
var seq: Int = -1,
var type: String = "",  // 批改类型：点赞、插入、修改、删除
var start: Int = -1,     // 起始索引
var len: Int = -1,       // 选择长度
var comment: String = "",   // 文字修改点评
var audio: String? = null,  // 语音点评数据
var duration: Int? = null,// 语音长度
)
